package edu.siu.cs.coonce.example;

import nrc.fuzzy.*;

public class Protoform extends BeanSupport {

     
    
    private static FuzzyVariable age = null;
    private static FuzzyValue fVal = null;
    
    static {
    	    try {
    			age = new FuzzyVariable("Age", 0, 100, "years");
    	    }
    	    catch (InvalidFuzzyVariableNameException nameEx) {}
    	    catch (InvalidUODRangeException rangeEx) {}
    	    
    	    try {
    	    	age.addTerm("young", new ZFuzzySet(10.0, 30.0));
    	    	age.addTerm("middle", new PIFuzzySet(30.0, 20.0));
				age.addTerm("old", new SFuzzySet(30.0, 50.0));
    	    }
    	    catch (XValuesOutOfOrderException outOfOrderEx) { }
    	    catch (XValueOutsideUODException outsideOUD) { }
    	    catch (Exception e) {}//i added this
    }

    public Protoform() {
       try { fVal = new FuzzyValue(age, "young"); } catch (Exception e) {}
       
    }
	
	public void setAge(String s) { try { fVal = new FuzzyValue(age, s); } catch (Exception e) {} }
	public String getAge() {
		return fVal.getLinguisticExpression();
	}
}

        
